/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmLogin.java
 *
 * Created on Apr 10, 2012, 12:31:12 AM
 */
package view;

import java.awt.event.ActionListener;

/**
 *
 * @author USER
 */
public class FrmLogin extends javax.swing.JFrame {

    private static FrmLogin _instance = null;

    public static synchronized FrmLogin getInstance() {
        if (_instance == null) {
            _instance = new FrmLogin();
        }

        return _instance;
    }

    /** Creates new form FrmLogin */
    private FrmLogin() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtUsuario = new javax.swing.JTextField();
        lblUsuario = new javax.swing.JLabel();
        lblSenha = new javax.swing.JLabel();
        txtSenha = new javax.swing.JPasswordField();
        btnLogin = new javax.swing.JButton();
        btnSair = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Login");
        setResizable(false);

        jPanel2.setBackground(new java.awt.Color(255, 255, 204));
        jPanel2.setForeground(new java.awt.Color(204, 204, 255));
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/img/lock.png"))); // NOI18N
        jPanel2.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 11, -1, -1));
        jPanel2.add(txtUsuario, new org.netbeans.lib.awtextra.AbsoluteConstraints(225, 18, 92, -1));

        lblUsuario.setText("Usuário:");
        jPanel2.add(lblUsuario, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 21, -1, -1));

        lblSenha.setText("Senha:");
        jPanel2.add(lblSenha, new org.netbeans.lib.awtextra.AbsoluteConstraints(181, 47, -1, -1));
        jPanel2.add(txtSenha, new org.netbeans.lib.awtextra.AbsoluteConstraints(225, 44, 92, -1));

        btnLogin.setText("Entrar");
        jPanel2.add(btnLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 80, 127, -1));

        btnSair.setText("Cancelar");
        jPanel2.add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 110, 127, -1));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void setActionListener(ActionListener al) {
        btnLogin.addActionListener(al);
        btnLogin.setActionCommand("Logar");
        btnSair.addActionListener(al);
        btnSair.setActionCommand("Sair");
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrmLogin().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnLogin;
    private javax.swing.JButton btnSair;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel lblSenha;
    private javax.swing.JLabel lblUsuario;
    public javax.swing.JPasswordField txtSenha;
    public javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables
}
